import { ChangeDetectorRef, Component } from '@angular/core';
 

import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzDescriptionsModule } from 'ng-zorro-antd/descriptions';
import { NzPageHeaderModule } from 'ng-zorro-antd/page-header';
import { NzSpaceModule } from 'ng-zorro-antd/space';
import { NzStatisticModule } from 'ng-zorro-antd/statistic';
import { NzTabsModule } from 'ng-zorro-antd/tabs';
import { NzDividerModule} from 'ng-zorro-antd/divider'
import { NonNullableFormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
import { inject } from '@angular/core';

import { NzFormModule } from 'ng-zorro-antd/form';
import { NzInputModule } from 'ng-zorro-antd/input';

import { NzTableModule } from 'ng-zorro-antd/table';

import { NzMessageService } from 'ng-zorro-antd/message';
import { HttpClient, HttpParams } from '@angular/common/http';

import { NzPopconfirmModule } from 'ng-zorro-antd/popconfirm';


import {getDeviceListUrl,addDeviceUrl,deleteDeviceByIdUrl} from '../constant'

 
import { NzModalModule } from 'ng-zorro-antd/modal';


import { NzIconModule } from 'ng-zorro-antd/icon';

import { NzUploadChangeParam, NzUploadModule } from 'ng-zorro-antd/upload';
import { batchUploadUrl} from  "../constant"

@Component({
  selector: 'app-device-batch',
  imports: [NzButtonModule, NzDescriptionsModule,
    NzPageHeaderModule, NzSpaceModule, NzStatisticModule, 
    NzTableModule,
    NzDividerModule,
    NzModalModule,
    NzPopconfirmModule,
    NzUploadModule,
    NzTabsModule,NzFormModule,NzInputModule,ReactiveFormsModule],
  templateUrl: './device-batch.html',
  styleUrl: './device-batch.scss'
})
export class DeviceBatch {

  
  batchUploadUrl:string=batchUploadUrl

  constructor(private messageService: NzMessageService) {}

  handleChange({ file, fileList }: NzUploadChangeParam): void {
    const status = file.status;
    if (status !== 'uploading') {
      console.log(file, fileList);
    }
    if (status === 'done') {
      this.messageService.success(`${file.name} file uploaded successfully.`);
    } else if (status === 'error') {
      this.messageService.error(`${file.name} file upload failed.`);
    }
  }
}